<template>
  <div class='column-item' v-if="column">
    <div class="top">
      <img :src="column.cover" alt="" v-if="column.cover">
      <img src="@/assets/column.jpg" alt="" v-else>
      <p>{{ column.title }}</p>
    </div>
    <div class="desc">
      <p>{{ column.description }}</p>
    </div>
    <div class="footer">
      <el-button type="primary" plain @click="$router.push(`column/${column.id}`)">进入专栏</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'MyColumnItem',
  props: {
    column: {
      type: Object,
      default: () => { }
    }
  },
  data () {
    return {
    }
  },
  components: {},
  methods: {},
  created () { },
  mounted () { }
}
</script>

<style lang='less' scoped>
.column-item {
  position: relative;
  height: 260px;
  margin-bottom: 20px;
  margin-right: 20px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;

  &:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  }
}

.top {
  margin: 10px 0;

  img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
  }

  p {
    line-height: 35px;
    font-size: 20px;
  }
}

.desc {
  height: 56px;
  font-size: 16px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.footer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10px;
}
</style>
